HAL FMAC types migration

This section provides information about the HAL FMAC types migration.

HAL FMAC state type definition

In HAL2, the state machine of the FMAC is split into three separate state machines:

hal_fmac_state_t, hal_fmac_x1_state_t and hal_fmac_y_state_t

HAL1

HAL2

typedef enum
{
  HAL_FMAC_STATE_RESET,
  HAL_FMAC_STATE_READY,
  HAL_FMAC_STATE_BUSY,
  HAL_FMAC_STATE_BUSY_RD,
  HAL_FMAC_STATE_BUSY_WR,
  HAL_FMAC_STATE_TIMEOUT,
  HAL_FMAC_STATE_ERROR
} HAL_FMAC_StateTypeDef;
typedef enum
{
  HAL_FMAC_STATE_ACTIVE_PRELOAD,
  HAL_FMAC_STATE_ACTIVE_FILTER,
  HAL_FMAC_STATE_IDLE,
  HAL_FMAC_STATE_RESET,
  HAL_FMAC_STATE_INIT
} hal_fmac_state_t;

typedef enum
{
  HAL_FMAC_STATE_X1_RESET,
  HAL_FMAC_STATE_X1_IDLE,
  HAL_FMAC_STATE_X1_ACTIVE_WRITE
} hal_fmac_x1_state_t;

typedef enum
{
  HAL_FMAC_STATE_Y_RESET,
  HAL_FMAC_STATE_Y_IDLE,
  HAL_FMAC_STATE_Y_ACTIVE_READ
} hal_fmac_y_state_t;

Related concept: Revised and optimized HAL state machine


HAL FMAC configuration type definition

HAL1

HAL2

typedef struct
{
  uint8_t  InputBaseAddress;
  uint8_t  InputBufferSize;
  uint8_t  CoeffBaseAddress;
  uint8_t  CoeffBufferSize;
  uint8_t  OutputBaseAddress;
  uint8_t  OutputBufferSize;







  uint32_t InputThreshold;
  uint32_t OutputThreshold;

  int16_t  *pCoeffA;
  uint8_t  CoeffASize;
  int16_t  *pCoeffB;
  uint8_t  CoeffBSize;

  uint32_t Clip;


  uint32_t Filter;
  uint8_t  P;
  uint8_t  Q;
  uint8_t  R;

  uint8_t  InputAccess;


  uint8_t  OutputAccess;
} FMAC_FilterConfigTypeDef;


typedef struct
{
  uint8_t  base_half_word;
  uint8_t  size_half_word;
} hal_fmac_buffer_t;

typedef struct
{
  hal_fmac_buffer_t x1_buf;
  hal_fmac_buffer_t x2_buf;
  hal_fmac_buffer_t y_buf;
} hal_fmac_config_t;

Removed: In HAL2 these parameters are handled by specific functions
(HAL_FMAC_SetX1FullWatermark / HAL_FMAC_SetYEmptyWatermark).

Removed: In HAL2 these parameters are handled by specific function HAL_FMAC_PreloadX2




Removed: In HAL2 this parameter is handled by specific functions
         (HAL_FMAC_EnableClip / HAL_FMAC_DisableClip / HAL_FMAC_IsEnabledClip).

Removed: In HAL2 these parameters are handled by specific functions
         (HAL_FMAC_StartFilterFIR / HAL_FMAC_StartFilterIIR)



Removed: in HAL2 we use HAL_FMAC_WriteX1(), HAL_FMAC_WriteX1_IT(), HAL_FMAC_WriteX1_DMA(), HAL_FMAC_WriteX1_DMA_Opt()
         to manage the input data and if we want another peripheral to handle the input data we do not simply call the Write X1 APIs.

Removed: in HAL2 we use HAL_FMAC_ReadY, HAL_FMAC_ReadY_IT, HAL_FMAC_ReadY_DMA, HAL_FMAC_ReadY_DMA_Opt
         to manage the output data, and if we want another peripheral to handle the input or output data, we do not simply call
         the Read Y APIs.

See HAL FMAC buffer access modes constants for more details.

Related concepts:

Related use cases:


HAL FMAC handle type definition

HAL1

HAL2

FMAC_HandleTypeDef
hal_fmac_handle_t

Related concept: Renaming of the handle structure


HAL FMAC callback ID type definition

HAL1

HAL2

typedef enum
{
  HAL_FMAC_ERROR_CB_ID,
  HAL_FMAC_HALF_GET_DATA_CB_ID,
  HAL_FMAC_GET_DATA_CB_ID,
  HAL_FMAC_HALF_OUTPUT_DATA_READY_CB_ID,
  HAL_FMAC_OUTPUT_DATA_READY_CB_ID,
  HAL_FMAC_FILTER_CONFIG_CB_ID,
  HAL_FMAC_FILTER_PRELOAD_CB_ID,
  HAL_FMAC_MSPINIT_CB_ID,
  HAL_FMAC_MSPDEINIT_CB_ID
} HAL_FMAC_CallbackIDTypeDef;
Notes:

The callback registration in HAL2 is handled by specific functions for each FMAC event.

See HAL FMAC callback register functions and HAL FMAC callback unregister functions for more details.

Related concept: Individual callback registration APIs replace global register and unregister functions


HAL FMAC callback type definition

HAL1

HAL2

pFMAC_CallbackTypeDef
hal_fmac_cb_t

Related concept: Replaced TypeDef suffix with _t in type names